import { defineComponent, onMounted, onUnmounted } from 'vue';
import Style from "./1080.module.scss";
import Image14 from '@/assets/images/14.png';
import Image12 from '@/assets/images/12.png';
import Image18 from '@/assets/images/18.png';
import Image16 from '@/assets/images/16.png';
import Image3 from '@/assets/images/3.png';
import Image6 from '@/assets/images/6.png';
import Image9 from '@/assets/images/9.png';
import ImageDy from '@/assets/images/dy.png';

import { useRouter } from 'vue-router';
import { KEEP_VIDEO_TOP } from '~/src/config';


export default defineComponent({
    setup() {

        const router = useRouter();

        const fetchHashValue = async () => {
            try {

                const response = await fetch('/dist/index.html'); // 指向你的index.html文件
                const text = await response.text();
                const regex = /<script type="module" crossorigin src="\.\/assets\/index\.([a-z0-9]+)\.js"><\/script>/;
                const match = text.match(regex);
                if (match && match[1]) {
                    console.log('找到的hash值是:', match[1]);
                    return match[1]; // 返回哈希值
                } else {
                    console.log('未找到hash值');
                    return null;
                }

            } catch (error) {
                console.error('获取hash值失败:', error);
            }
        };

        let timmer: any = null
        onMounted(() => {
            timmer = setInterval(() => fetchHashValue(), 10000)
        })

        onUnmounted(() => {
            clearInterval(timmer)
        })

        return () => (<>
        {
            !KEEP_VIDEO_TOP? <div class={Style.video}>
            <div class={Style.video_pad}>
                <video class="vid" style={{ width: '100%', height: '100%' }} id="video" src="http://ld.zjldsoft.com:80/ldzzj/ldzzj/api?code=env.vedio&_t=" autoplay="true" loop muted>
                </video>
            </div>
        </div>:""
        }


            <div class={Style.content_mar}>
                <div class={Style.content}>
                    <div class={Style.item} onClick={() => {
                        router.push({
                            path: "/readCard", query: {

                            }
                        })
                    }}>
                        <div >
                            <div class={Style.text1}>
                                挂号
                            </div>
                            <div class={Style.text2}>
                                当日挂号排队
                            </div>
                        </div>
                        <img class={Style.item_icon} src={Image14} />
                    </div>

                    <div class={[Style.item, Style.item2]} onClick={() => {
                        router.push({
                            path: "/sfxzAddress", query: {

                            }
                        })
                    }}>
                        <div>
                            <div class={Style.text1}>
                                取号
                            </div>
                            <div class={Style.text2}>
                                门诊取号看病
                            </div>
                        </div>
                        <img class={Style.item_icon} src={Image12} />
                    </div>

                    <div class={[Style.item, Style.item3]} onClick={() => {
                        router.push({
                            path: "/selectClinicArea", query: {

                            }
                        })
                    }}>
                        <div>
                            <div class={Style.text1}>
                                预约
                            </div>
                            <div class={Style.text2}>
                                可预约7日内号源
                            </div>
                        </div>
                        <img class={Style.item_icon} src={Image18} />
                    </div>

                    <div class={[Style.item, Style.item4]} onClick={() => {
                        router.push({
                            path: "/mzjf", query: {

                            }
                        })
                    }}>
                        <div>
                            <div class={Style.text1}>
                                门诊缴费
                            </div>
                            <div class={Style.text2}>
                                门诊费用查询缴纳
                            </div>
                        </div>
                        <img class={Style.item_icon} src={Image16} />
                    </div>

                    <div class={Style.min_content}>
                        <div class={Style.min_item} onClick={() => {
                            router.push({
                                path: "", query: {

                                }
                            })
                        }}>
                            <div class={[Style.min_img, Style.img1]}>
                                <img class={Style.min_icon}  src={ImageDy} />
                            </div>
                            <div class={Style.min_item_text}>
                                打印<br />化验单
                            </div>
                        </div>

                        <div class={[Style.min_item, Style.min_item2]} onClick={() => {
                            router.push({
                                path: "/zyyj", query: {

                                }
                            })
                        }}>
                            <div class={[Style.min_img, Style.img2]} >
                                <img class={Style.min_icon}  src={Image3} />
                            </div>
                            <div class={Style.min_item_text}>
                                住院<br />预缴金
                            </div>
                        </div>

                        <div class={[Style.min_item, Style.min_item3]}>
                            <div class={[Style.min_img, Style.img3]} >
                                <img class={Style.min_icon}  src={Image6} />
                            </div>
                            <div class={Style.min_item_text}>
                                住院费用<br />清单查询
                            </div>
                        </div>

                        <div class={[Style.min_item, Style.min_item4]} onClick={() => {
                            router.push({
                                path: "/PriceQuery", query: {

                                }
                            })
                        }}>
                            <div class={[Style.min_img, Style.img4]} >
                                <img class={[Style.min_icon, Style.min_icon2]}  src={Image9} />
                            </div>
                            <div class={[Style.min_item_text, Style.min_item_text_wjcx]}>
                                物价查询
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </>);
    }
})
